﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MaxLeaf.KH.Contract;
using MaxLeaf.KH.DALImplementation;
using CommonsLib.Utility;
using MaxLeaf.KH.DataContract;

namespace MaxLeaf.KH.DALProxy
{
    public class BasicMtnDALProxy : BaseDALProxy, IBasicMtn
    {
        IBasicMtn dal;
        public BasicMtnDALProxy():base()
        {
            switch ( Access_Mode )
            {
                
                case MaxLeaf.Commons.Enum.ACCESS_Direct:
                    {
                        dal = new BasicMtnDAL();
                        break;
                    }

                case MaxLeaf.Commons.Enum.ACCESS_IIS:
                    {
                        dal = new BasicMtnDALWCFClient(this.WCF_Configs);
                        break;
                    }

                 
                default: throw new Exception(MaxLeaf.Commons.Const.EXCEPTION_MESSAGE_INVALID_ACCESSMODE_CONFIG);
            }
        }



        public object Select(object model, int intKeyValue)
        {
             
                return dal.Select(model, intKeyValue);
             
        }

        public List<object>  SelectDtl(object model, int intForeignKeyValue)
        {

            return dal.SelectDtl(model, intForeignKeyValue);

        }

        public object Add(object model)
        {
             
                return dal.Add(model);
             
            
        }

        public object Update(object model)
        {
             
                return dal.Update(model);
             
            
        }

        public object Delete(object model)
        {
             
                return dal.Delete(model);
             
            
        }
    }
}
